package hczc.longcai.com.hccrowdfunding.home.second_invest.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;
import hczc.longcai.com.hccrowdfunding.home.second_invest.adapters.ProjectDynamicAdapter;
import hczc.longcai.com.hccrowdfunding.home.second_invest.beans.ProjectDynamic;

public class ProjectDynamicActivity extends BaseActivity implements View.OnClickListener, View.OnTouchListener {

    private View back;
    private TextView title;
    private ListView listView;
    private List<ProjectDynamic> list;
    private ProjectDynamicAdapter adapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_project_dynamic);

        initDatas();
        initViews();
    }

    private void initDatas() {
        list = new ArrayList<>();
        list.add(new ProjectDynamic());
        list.add(new ProjectDynamic(null,"截止12月8日，发行融资已过30%，希望预约过的投资人及时跟进，众筹早日成功。截止12月8日，发行融资已过30%，希望预约过的投资人及时跟进，众筹早日成功。截止12月8日，发行融资已过30%，希望预约过的投资人及时跟进，众筹早日成功。"));
        list.add(new ProjectDynamic());
    }

    private void initViews() {
        back = findViewById(R.id.head_back);
        back.setOnClickListener(this);
        back.setOnTouchListener(this);
        title = ((TextView) findViewById(R.id.head_title));
        title.setText("项目动态");
        findViewById(R.id.head_right_pic).setVisibility(View.GONE);

        listView = ((ListView) findViewById(R.id.invest_project_dynamic_listview));
        adapter = new ProjectDynamicAdapter(this,list);
        listView.setAdapter(adapter);

    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id){
            case R.id.head_back:
                finish();
                break;
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        view.setPressed(true);
        return false;
    }
}
